import logging

from hdfs.client import Client

logger = logging.getLogger('global_log')


def download(hdfs_path, local_path):
    try:
        client = Client("http://127.0.0.1:50070/")
        client.download(hdfs_path, local_path, overwrite=True, n_threads=1)
        return True
    except IOError:
        logger.error("Failed to download data from HDFS,", hdfs_path, local_path)
    return False
